package com.atguigu.oss.controller;

import com.atguigu.common_uitls.R;
import com.atguigu.oss.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * zz: wzh
 * time 2022 09 21 19 58
 **/
@RestController
@RequestMapping("/eduoss/fileoss")
@CrossOrigin
public class OssController {
    @Autowired
    private OssService ossService;

    //上喘头像
    @PostMapping()
    public R   uploadOssFile(MultipartFile multipartFile){
        //获取上窜文件
        String url=ossService.uploadFileAvatar(multipartFile);
        return R.ok().data("url",url);
    }
}
